package main

import "github.com/gin-gonic/gin"

type UserInfo struct {
	Name string `json:"Name"`
	Age  int    `json:"Age"`
}
type Response struct {
	Code int    `json:"code"`
	Data any    `json:"data"`
	Msg  string `json:"msg"`
}

func userList(c *gin.Context) {
	var userList []UserInfo = []UserInfo{
		{"xxx", 11},
		{"yyy", 22},
	}
	c.JSON(200, Response{200, userList, "成功"})
}
func main() {
	router := gin.Default()
	userRouter := router.Group("/user")
	{
		userRouter.GET("/getUserList", userList)
	}
	router.Run(":8080")
}
